package DMSXL._2024.BinaryTrees;

public class convertBST {
    public static void main(String[] args) {

    }
    int max = 0;
    public TreeNode convertBST(TreeNode root) {
        if(root == null){
            return null;
        }
        convertBST(root.right);
        max += root.val;
        root.val = max;
        convertBST(root.left);
        return root;
    }
}
